home *** CD-ROM | disk | FTP | other *** search
/ Programmers Heaven 2 / Programmers Heaven 2.iso / files / windows / ocx / ipack.exe / NEWS.FRM (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1996-09-22  |  23.2 KB  |  735 lines

  1. VERSION 4.00
  2. Begin VB.Form Form1 
  3.    Caption         =   "Mabry News"
  4.    ClientHeight    =   8025
  5.    ClientLeft      =   1560
  6.    ClientTop       =   1905
  7.    ClientWidth     =   9990
  8.    Height          =   8715
  9.    Left            =   1500
  10.    LinkTopic       =   "Form1"
  11.    LockControls    =   -1  'True
  12.    ScaleHeight     =   535
  13.    ScaleMode       =   3  'Pixel
  14.    ScaleWidth      =   666
  15.    Top             =   1275
  16.    Width           =   10110
  17.    Begin VB.CommandButton cmdCancelMsg 
  18.       Caption         =   "Cancel Msg"
  19.       Height          =   360
  20.       Left            =   6330
  21.       TabIndex        =   14
  22.       Top             =   135
  23.       Width           =   1035
  24.    End
  25.    Begin VB.CheckBox Flag 
  26.       Caption         =   "Flag"
  27.       Height          =   285
  28.       Left            =   9675
  29.       TabIndex        =   13
  30.       Top             =   240
  31.       Visible         =   0   'False
  32.       Width           =   750
  33.    End
  34.    Begin VB.CommandButton cmdReply 
  35.       Caption         =   "Reply"
  36.       Height          =   360
  37.       Left            =   5280
  38.       TabIndex        =   12
  39.       Top             =   135
  40.       Width           =   1050
  41.    End
  42.    Begin VB.CommandButton cmdNewArticle 
  43.       Caption         =   "New Article"
  44.       Height          =   360
  45.       Left            =   4230
  46.       TabIndex        =   11
  47.       Top             =   135
  48.       Width           =   1050
  49.    End
  50.    Begin VB.CheckBox Check2 
  51.       Caption         =   "Trace"
  52.       Height          =   195
  53.       Left            =   8520
  54.       TabIndex        =   10
  55.       Top             =   315
  56.       Width           =   795
  57.    End
  58.    Begin VB.CommandButton cmdVSplit 
  59.       Appearance      =   0  'Flat
  60.       BackColor       =   &H80000005&
  61.       Height          =   2880
  62.       Left            =   4395
  63.       MousePointer    =   9  'Size W E
  64.       TabIndex        =   9
  65.       TabStop         =   0   'False
  66.       Top             =   600
  67.       Width           =   90
  68.    End
  69.    Begin VB.CommandButton cmdHSplit 
  70.       BeginProperty Font 
  71.          name            =   "Arial"
  72.          charset         =   0
  73.          weight          =   400
  74.          size            =   1.5
  75.          underline       =   0   'False
  76.          italic          =   0   'False
  77.          strikethrough   =   0   'False
  78.       EndProperty
  79.       Height          =   90
  80.       Left            =   0
  81.       MousePointer    =   7  'Size N S
  82.       TabIndex        =   8
  83.       Top             =   3480
  84.       Width           =   9765
  85.    End
  86.    Begin VB.TextBox Text1 
  87.       BeginProperty Font 
  88.          name            =   "Courier New"
  89.          charset         =   0
  90.          weight          =   400
  91.          size            =   11.25
  92.          underline       =   0   'False
  93.          italic          =   0   'False
  94.          strikethrough   =   0   'False
  95.       EndProperty
  96.       Height          =   4230
  97.       Left            =   30
  98.       Locked          =   -1  'True
  99.       MultiLine       =   -1  'True
  100.       ScrollBars      =   3  'Both
  101.       TabIndex        =   7
  102.       Top             =   3570
  103.       Width           =   9690
  104.    End
  105.    Begin VB.ListBox listArticles 
  106.       Height          =   2775
  107.       IntegralHeight  =   0   'False
  108.       ItemData        =   "NEWS.frx":0000
  109.       Left            =   4440
  110.       List            =   "NEWS.frx":0002
  111.       TabIndex        =   6
  112.       Top             =   660
  113.       Width           =   5235
  114.    End
  115.    Begin VB.CommandButton cmdGetNewGroups 
  116.       Caption         =   "New Groups"
  117.       Height          =   360
  118.       Left            =   2130
  119.       TabIndex        =   5
  120.       Top             =   135
  121.       Width           =   1050
  122.    End
  123.    Begin VB.ListBox listGroups 
  124.       Height          =   2775
  125.       IntegralHeight  =   0   'False
  126.       Left            =   30
  127.       TabIndex        =   4
  128.       Top             =   660
  129.       Width           =   4335
  130.    End
  131.    Begin VB.CommandButton cmdGetAllGroups 
  132.       Caption         =   "All Groups"
  133.       Height          =   360
  134.       Left            =   3180
  135.       TabIndex        =   3
  136.       Top             =   135
  137.       Width           =   1050
  138.    End
  139.    Begin VB.CheckBox Check1 
  140.       Caption         =   "Blocking"
  141.       Height          =   195
  142.       Left            =   8520
  143.       TabIndex        =   2
  144.       Top             =   105
  145.       Width           =   960
  146.    End
  147.    Begin VB.CommandButton cmdDisconnect 
  148.       Caption         =   "Disconnect"
  149.       Height          =   360
  150.       Left            =   1080
  151.       TabIndex        =   1
  152.       Top             =   135
  153.       Width           =   1050
  154.    End
  155.    Begin VB.CommandButton cmdConnect 
  156.       Caption         =   "Connect"
  157.       Height          =   360
  158.       Left            =   30
  159.       TabIndex        =   0
  160.       Top             =   135
  161.       Width           =   1050
  162.    End
  163.    Begin NewsLib.News News1 
  164.       Left            =   7560
  165.       Top             =   120
  166.       _Version        =   327680
  167.       _ExtentX        =   847
  168.       _ExtentY        =   847
  169.       _StockProps     =   0
  170.       Debug           =   1
  171.       Blocking        =   -1  'True
  172.       Timeout         =   0
  173.    End
  174.    Begin VB.Line Line3 
  175.       BorderColor     =   &H00FFFFFF&
  176.       X1              =   0
  177.       X2              =   911
  178.       Y1              =   0
  179.       Y2              =   0
  180.    End
  181.    Begin VB.Line Line2 
  182.       BorderColor     =   &H00FFFFFF&
  183.       X1              =   -4
  184.       X2              =   907
  185.       Y1              =   39
  186.       Y2              =   39
  187.    End
  188.    Begin VB.Line Line1 
  189.       BorderColor     =   &H00808080&
  190.       X1              =   0
  191.       X2              =   658
  192.       Y1              =   38
  193.       Y2              =   38
  194.    End
  195.    Begin VB.Menu FileMenu 
  196.       Caption         =   "&File"
  197.       Begin VB.Menu FileExit 
  198.          Caption         =   "E&xit"
  199.       End
  200.    End
  201.    Begin VB.Menu SettingsMenu 
  202.       Caption         =   "&Settings"
  203.       Begin VB.Menu SettingsUser 
  204.          Caption         =   "&User..."
  205.       End
  206.       Begin VB.Menu SettingsConnection 
  207.          Caption         =   "&Connection..."
  208.       End
  209.    End
  210.    Begin VB.Menu ShowMenu 
  211.       Caption         =   "Sh&ow"
  212.       Begin VB.Menu ShowHeaders 
  213.          Caption         =   "&Headers"
  214.       End
  215.    End
  216. Attribute VB_Name = "Form1"
  217. Attribute VB_Creatable = False
  218. Attribute VB_Exposed = False
  219. ' Sample program for Mabry News Control
  220. ' This sample shows both blocking and non-blocking use of
  221. ' the Mabry News control.  Please note that this sample does
  222. ' not trap errors returned by the control (connection failure,
  223. ' for instance).  If an error is returned you'll see the usual VB
  224. ' error message box.
  225. ' Zane Thomas/May 96
  226. Option Explicit
  227. ' state is used in non-blocking mode to determine what to do
  228. ' when the Done and DataReady events are fired
  229. Dim state As Integer
  230. Private Const StateDisconnected = 0
  231. Private Const StateGetGroups = 1
  232. Private Const StateSelectGroup = 2
  233. Private Const StateGetArticleIDs = 3
  234. Private Const StateGetArticle = 4
  235. Private Const StateGetHeader = 5
  236. Private Const StateXOver = 6
  237. Const StateConnecting = 7
  238. Const StateConnected = 8
  239. Const StateDisconnecting = 9
  240. ' For spacing during Form_Resize
  241. Private Const Margin = 2
  242. ' Used during article and group retrieval, see AddArticleIDsToList
  243. ' and Add GroupsToList for details
  244. Dim articleIndex As Integer
  245. Dim groupIndex As Integer
  246. ' Properties accessed by setup forms
  247. Private m_emailaddr As String
  248. Private m_logonname As String
  249. Private m_logonpass As String
  250. Public Property Let EmailAddr(s As String)
  251.     m_emailaddr = s
  252. End Property
  253. Public Property Get EmailAddr() As String
  254.     EmailAddr = m_emailaddr
  255. End Property
  256. Public Property Let LogonName(s As String)
  257.     m_logonname = s
  258. End Property
  259. Public Property Get LogonName() As String
  260.     LogonName = m_logonname
  261. End Property
  262. Public Property Let LogonPass(s As String)
  263.     m_logonpass = s
  264. End Property
  265. Public Property Get LogonPass() As String
  266.     LogonPass = m_logonpass
  267. End Property
  268. '''''''''''''''''''''''''''''''''''''''''''''''''''
  269. '  Command Buttons
  270. '''''''''''''''''''''''''''''''''''''''''''''''''''
  271. Private Sub cmdConnect_Click()
  272.     News1.LogonName = Me.LogonName
  273.     News1.LogonPassword = Me.LogonPass
  274.     listGroups.Clear
  275.     listArticles.Clear
  276.     Text1.Text = ""
  277.     If (Check1.Value = 1) Then
  278.         News1.Blocking = True
  279.     Else
  280.         News1.Blocking = False
  281.     End If
  282.     EnableControls False
  283.     state = StateConnecting
  284.     News1.Action = NewsConnect
  285.     If (News1.Blocking) Then
  286.         News1_Done 0
  287.     End If
  288. End Sub
  289. Private Sub cmdDisconnect_Click()
  290.     EnableControls False
  291.     state = StateDisconnecting
  292.     News1.Action = NewsDisconnect
  293.     listGroups.Clear
  294.     listArticles.Clear
  295.     Text1.Text = ""
  296.     If (News1.Blocking) Then
  297.         News1_Done 0
  298.     End If
  299. End Sub
  300. Private Sub cmdGetAllGroups_Click()
  301.     Dim i As Integer
  302.     state = StateGetGroups
  303.     EnableControls False
  304.     listGroups.Clear
  305.     groupIndex = 0
  306.     News1.Action = NewsGetAllGroups
  307.     If (News1.Blocking) Then
  308.         News1_Done 0
  309.     End If
  310. End Sub
  311. Private Sub cmdGetNewGroups_Click()
  312.     state = StateGetGroups
  313.     '
  314.     ' A real newsreader would keep track of the last
  315.     ' time the news groups were updated and supply an
  316.     ' appropriate date here
  317.     '
  318.     News1.Date = Format("04/30/1996 00:00:00", "ddd, dd mmm yyyy hh:mm:ss")
  319.     EnableControls False
  320.     listGroups.Clear
  321.     groupIndex = 0
  322.     News1.Action = NewsGetNewGroups
  323.     If (News1.Blocking) Then
  324.         News1_Done 0
  325.     End If
  326. End Sub
  327. Private Sub cmdNewArticle_Click()
  328.     PostArticle False
  329. End Sub
  330. Private Sub cmdReply_Click()
  331.     PostArticle True
  332. End Sub
  333. Sub PostArticle(reply As Boolean)
  334.     Dim i As Integer
  335.     Dim j As Integer
  336.     Dim s As String
  337.     Dim body As String
  338.     '
  339.     ' Set user info from e-mail address
  340.     '
  341.     i = InStr(m_emailaddr, "@")
  342.     j = InStr(m_emailaddr, "(") - 1
  343.     News1.EMailAddress = m_emailaddr
  344.     News1.PostingHost = Mid(m_emailaddr, i + 1, j - i - 1)
  345.     '
  346.     ' Add optional headers
  347.     '
  348.     News1.HeadersCount = 0
  349.     News1.Headers(0) = "Organization: Mabry Software http://www.mabry.com"
  350.     News1.Headers(1) = "X-Newsreader: Mabry News"
  351.     News1.Headers(2) = "X-Test: foo"
  352.     '
  353.     ' If this is a reply message
  354.     '
  355.     If (reply) Then
  356.         '
  357.         ' Set references line
  358.         '
  359.         s = News1.References & " " & News1.ArticleID
  360.         Do While (Len(s) > 512)
  361.             i = InStr(s, "> <")
  362.             If (i = 0) Then
  363.                 ' This should never happen ... but
  364.                 Exit Do
  365.             End If
  366.             s = Right(s, Len(s) - (i + 1))
  367.         Loop
  368.         News1.References = s
  369.         '
  370.         ' Set groups and subject
  371.         '
  372.         NewMessage.NewsGroups.Text = News1.NewsGroups
  373.         If (StrConv(Left(News1.Subject, 3), vbLowerCase) <> "re:") Then
  374.             NewMessage.Subject.Text = "Re: " & News1.Subject
  375.         Else
  376.             NewMessage.Subject.Text = News1.Subject
  377.         End If
  378.         '
  379.         ' Quote body text in reply
  380.         '
  381.         s = News1.BodyText
  382.         body = News1.From & " wrote:" & vbCrLf
  383.         Do While (s <> "")
  384.             body = body & ">" & Left(s, InStr(s, Chr(13)) + 1)
  385.             s = Right(s, Len(s) - (InStr(s, Chr(13)) + 1))
  386.         Loop
  387.         NewMessage.body.Text = body
  388.     Else
  389.         '
  390.         ' New message
  391.         '
  392.         NewMessage.NewsGroups.Text = News1.group
  393.         NewMessage.Subject.Text = ""
  394.         News1.References = ""
  395.     End If
  396.     Flag.Value = 0
  397.     NewMessage.Show 1
  398.     If (Flag.Value = 0) Then
  399.         Exit Sub
  400.     End If
  401.     News1.ArticleID = Format(Now(), "ddmmyyhhmmss") & "@" & News1.PostingHost
  402.     News1.Date = Format(Now(), "ddd, dd mmm yyyy hh:mm:ss ") & "-0700"
  403.     News1.PostArticle
  404. End Sub
  405. Private Sub cmdCancelMsg_Click()
  406.     Dim i As Integer
  407.     Dim j As Integer
  408.     i = InStr(m_emailaddr, "@")
  409.     j = InStr(m_emailaddr, "(") - 1
  410.     News1.EMailAddress = m_emailaddr
  411.     News1.PostingHost = Mid(m_emailaddr, i + 1, j - i - 1)
  412.     News1.HeadersCount = 0
  413.     News1.Subject = "cmsg cancel " & News1.ArticleID
  414.     News1.NewsGroups = News1.NewsGroups & ",control.cancel"
  415.     News1.Headers(0) = "Control: cancel " & News1.ArticleID
  416.     News1.ArticleID = Format(Now(), "ddmmyyhhmmss") & "@" & News1.PostingHost
  417.     News1.Date = Format(Now(), "ddd, dd mmm yyyy hh:mm:ss ") & "-0700"
  418.     News1.References = ""
  419.     News1.BodyText = ""
  420.     News1.PostArticle
  421. End Sub
  422. ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
  423. ' News Control Events
  424. ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
  425. Private Sub News1_AsyncError(ByVal ErrorCode As Long, ByVal Description As String)
  426.     MsgBox "AsyncError: " & Description
  427.     EnableControls True
  428. End Sub
  429. Private Sub News1_DataReady()
  430.     Select Case state
  431.         Case StateGetGroups
  432.             AddGroupsToList groupIndex
  433.     End Select
  434. End Sub
  435. Private Sub News1_Debug(ByVal Text As String)
  436.     If (Check2.Value <> 0) Then
  437.         Debug.Print Text
  438.     End If
  439. End Sub
  440. Private Sub News1_Done(ByVal ErrorCode As Integer)
  441.     Dim i As Integer
  442.     Select Case state
  443.         Case StateConnecting
  444.             If (ErrorCode = 0) Then
  445.                 state = StateConnected
  446.             End If
  447.             EnableControls True
  448.         Case StateDisconnecting
  449.             state = StateDisconnected
  450.             EnableControls True
  451.         Case StateGetArticleIDs
  452.             state = StateConnected
  453.             articleIndex = 0
  454.             ListHeaders
  455.         Case StateGetGroups
  456.             AddGroupsToList groupIndex
  457.             state = StateConnected
  458.             EnableControls True
  459.         Case StateSelectGroup
  460.             '
  461.             ' Just finished selecting a group, get the article ids
  462.             '
  463. ' Use this code if the xover command isn't
  464. ' supported for the connected server
  465. '            state = StateGetArticleIDs
  466. '            listArticles.Clear
  467. '            News1.Date = Format("05/22/1996 12:00:00", "ddd, dd mmm yyyy hh:mm:ss")
  468. '            articleIndex = 0
  469. '            News1.GetNewNews
  470.             Flag.Value = 0
  471.             
  472.             msgrange.First.Text = News1.FirstArticle
  473.             msgrange.Last.Text = News1.LastArticle
  474.             msgrange.Show 1
  475.             If (Flag.Value = 0) Then
  476.                 state = StateConnected
  477.                 EnableControls True
  478.                 Exit Sub
  479.             End If
  480. ''''''''''''''''''''''
  481. ' cut this code for non-xover servers
  482.             state = StateXOver
  483.             News1.Action = NewsXover
  484. ' end cut
  485. ''''''''''''''''''''''
  486.             If (News1.Blocking) Then
  487.                 ListHeaders
  488.                 state = StateConnected
  489.                 EnableControls True
  490.             End If
  491.         Case StateGetArticle
  492.             state = StateConnected
  493.             EnableControls True
  494.             If (ShowHeaders.Checked) Then
  495.                 Text1.Text = News1.HeaderText & Chr$(13) & Chr$(10) & News1.BodyText
  496.             Else
  497.                 Text1.Text = News1.BodyText
  498.             End If
  499.         Case StateGetHeader
  500.             listArticles.AddItem News1.Subject
  501.             ListHeaders
  502.         Case StateXOver
  503.             ListHeaders
  504.             state = StateConnected
  505.             EnableControls True
  506.         Case Else
  507.             state = StateConnected
  508.             EnableControls True
  509.     End Select
  510. End Sub
  511. '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
  512. ' Form
  513. '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
  514. Private Sub FileExit_Click()
  515.     End
  516. End Sub
  517. Private Sub Form_Load()
  518.     state = StateDisconnected
  519.     EnableControls True
  520.     News1.Host = "msnews.microsoft.com"
  521.     News1.LogonName = ""
  522.     News1.LogonPassword = ""
  523.     Me.Show
  524.     SetPopupPos UserInfo
  525.     UserInfo.Show 1
  526. End Sub
  527. Private Sub Form_Resize()
  528.     Line1.X2 = Me.ScaleWidth
  529.     Line2.X2 = Me.ScaleWidth
  530.     Line3.X2 = Me.ScaleWidth
  531.     cmdVSplit.Height = cmdHSplit.Top - Line2.Y2 - 1
  532.     cmdHSplit.Width = Me.ScaleWidth
  533.     listGroups.Top = Line2.Y1 + Margin
  534.     listGroups.Height = cmdHSplit.Top - Line2.Y1 - Margin * 2
  535.     listGroups.Left = Margin
  536.     listGroups.Width = cmdVSplit.Left - Margin * 2
  537.     listArticles.Top = Line2.Y1 + Margin
  538.     listArticles.Height = cmdHSplit.Top - Line2.Y1 - Margin * 2
  539.     listArticles.Left = cmdVSplit.Left + cmdVSplit.Width + Margin
  540.     listArticles.Width = Me.ScaleWidth - listArticles.Left - Margin
  541.     Text1.Top = cmdHSplit.Top + cmdHSplit.Height + Margin
  542.     Text1.Height = Me.ScaleHeight - (cmdHSplit.Top + cmdHSplit.Height) - Margin * 2
  543.     Text1.Left = Margin
  544.     Text1.Width = Me.ScaleWidth - Margin * 2
  545. End Sub
  546. '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
  547. ' Menus
  548. '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
  549. Private Sub SettingsConnection_Click()
  550.     SetPopupPos ConnectionOptionsForm
  551.     ConnectionOptionsForm.Show 1
  552. End Sub
  553. Private Sub SettingsUser_Click()
  554.     SetPopupPos UserInfo
  555.     UserInfo.Show 1
  556. End Sub
  557. Private Sub ShowHeaders_Click()
  558.     ShowHeaders.Checked = Not ShowHeaders.Checked
  559.     If (ShowHeaders.Checked) Then
  560.         Text1.Text = News1.HeaderText & Chr$(13) & Chr$(10) & News1.BodyText
  561.     Else
  562.         Text1.Text = News1.BodyText
  563.     End If
  564. End Sub
  565. '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
  566. ' List Boxes
  567. '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
  568. Private Sub listGroups_DblClick()
  569.     News1.group = listGroups.List(listGroups.ListIndex)
  570.     News1.NewsGroups = News1.group
  571.     state = StateSelectGroup
  572.     EnableControls False
  573.     News1.SelectGroup
  574.     listArticles.Clear
  575.     If (News1.Blocking) Then
  576.         News1_Done 0
  577.     End If
  578. End Sub
  579. Private Sub listArticles_DblClick()
  580. ' Use this code for non-xover servers
  581. '    News1.ArticleID = News1.ArticleIDs(listArticles.ListIndex)
  582. ' cut here for non-xover servers
  583.     News1.ArticleID = listArticles.ItemData(listArticles.ListIndex)
  584. ' end cut
  585.     state = StateGetArticle
  586.     EnableControls False
  587.     News1.GetArticle
  588.     If (News1.Blocking) Then
  589.         News1_Done 0
  590.     End If
  591. End Sub
  592. '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
  593. ' Splitters
  594. '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
  595. Private Sub cmdHSplit_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
  596.     Dim oldy As Integer
  597.     Dim newy As Integer
  598.     Y = Y / Screen.TwipsPerPixelY
  599.     oldy = cmdHSplit.Top
  600.     newy = Y + cmdHSplit.Top - (cmdHSplit.Height / 2)
  601.     If (newy = oldy) Then
  602.         Exit Sub
  603.     End If
  604.     If (Button) Then
  605.         cmdHSplit.Top = newy
  606.         listGroups.Height = cmdHSplit.Top - listGroups.Top - Margin
  607.         listArticles.Height = listGroups.Height
  608.         Text1.Top = cmdHSplit.Top + cmdHSplit.Height + Margin
  609.         Text1.Height = Me.ScaleHeight - (cmdHSplit.Top + cmdHSplit.Height) - Margin * 2
  610.         cmdVSplit.Height = cmdHSplit.Top - Line2.Y2 - 1
  611.     End If
  612. End Sub
  613. Private Sub cmdHSplit_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
  614.     If (listGroups.Enabled) Then
  615.         listGroups.SetFocus
  616.     End If
  617. End Sub
  618. Private Sub cmdVSplit_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
  619.     Dim oldx As Integer
  620.     Dim newx As Integer
  621.     X = X / Screen.TwipsPerPixelX
  622.     oldx = cmdVSplit.Left
  623.     newx = X + cmdVSplit.Left - (cmdVSplit.Width / 2)
  624.     If (newx = oldx) Then
  625.         Exit Sub
  626.     End If
  627.     If (Button) Then
  628.         cmdVSplit.Left = newx
  629.         listGroups.Width = cmdVSplit.Left - listGroups.Left - Margin
  630.         listArticles.Left = cmdVSplit.Left + Margin + cmdVSplit.Width
  631.         listArticles.Width = Me.ScaleWidth - listArticles.Left - 2 * Margin
  632.     End If
  633. End Sub
  634. Private Sub cmdVSplit_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
  635.     If (listGroups.Enabled) Then
  636.         listGroups.SetFocus
  637.     End If
  638. End Sub
  639. '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
  640. ' Misc Subs
  641. ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
  642. Private Sub EnableControls(fEnable As Boolean)
  643.     If (fEnable = False) Then
  644.         cmdConnect.Enabled = fEnable
  645.         cmdDisconnect.Enabled = fEnable
  646.         cmdGetAllGroups.Enabled = fEnable
  647.         cmdGetNewGroups.Enabled = fEnable
  648.         cmdNewArticle.Enabled = fEnable
  649.         cmdReply.Enabled = fEnable
  650.         cmdCancelMsg.Enabled = fEnable
  651.         listGroups.Enabled = fEnable
  652.         listArticles.Enabled = fEnable
  653.     ElseIf (state = StateConnected) Then
  654.         cmdConnect.Enabled = False
  655.         cmdDisconnect.Enabled = True
  656.         cmdGetAllGroups.Enabled = True
  657.         cmdGetNewGroups.Enabled = True
  658.         cmdNewArticle.Enabled = True
  659.         cmdReply.Enabled = True
  660.         cmdCancelMsg.Enabled = True
  661.         If (listGroups.ListCount > 0) Then
  662.             listGroups.Enabled = True
  663.         Else
  664.             listGroups.Enabled = False
  665.         End If
  666.         If (listArticles.ListCount > 0) Then
  667.             listArticles.Enabled = True
  668.         Else
  669.             listArticles.Enabled = False
  670.         End If
  671.     Else
  672.         cmdConnect.Enabled = True
  673.         cmdDisconnect.Enabled = False
  674.         cmdGetAllGroups.Enabled = False
  675.         cmdGetNewGroups.Enabled = False
  676.         cmdNewArticle.Enabled = False
  677.         cmdReply.Enabled = False
  678.         cmdCancelMsg.Enabled = False
  679.         listGroups.Enabled = False
  680.         listArticles.Enabled = False
  681.     End If
  682. End Sub
  683. Sub AddGroupsToList(i As Integer)
  684.     Dim group As String
  685.     Do While (i < News1.GroupCount)
  686.         group = News1.Groups(i)
  687.         group = Left$(group, InStr(group, " ") - 1)
  688.         listGroups.AddItem group
  689.         i = i + 1
  690.     Loop
  691. End Sub
  692. Sub ListHeaders()
  693. '''''''''''''''''
  694. ' cut here for non-xover servers
  695.     Dim i As Integer
  696.     Dim s As String
  697.     Dim n As Long
  698.     For i = 0 To News1.XOverHeadersCount - 1
  699.         s = News1.XOverHeaders(i)
  700.         n = Val(Left(s, InStr(s, Chr(9)) - 1))
  701.         s = Right(s, Len(s) - InStr(s, Chr(9)))
  702.         s = Left(s, InStr(s, Chr(9)))
  703.         listArticles.AddItem s
  704.         listArticles.ItemData(i) = n
  705.     Next
  706. ' end cut
  707. '''''''''''''''''
  708. ' Use this code for non-xover servers
  709. ' Note: Getting individual headers is a whole lot slower than using
  710. ' xover.
  711. '    If (News1.Blocking) Then
  712. '        Do While articleIndex < News1.ArticleIDsCount
  713. '            News1.ArticleID = News1.ArticleIDs(articleIndex)
  714. '            News1.GetHeader
  715. '            listArticles.AddItem News1.Subject
  716. '            articleIndex = articleIndex + 1
  717. '            DoEvents
  718. '        Loop
  719. '    Else
  720. '        If (articleIndex < News1.ArticleIDsCount) Then
  721. '            News1.ArticleID = News1.ArticleIDs(articleIndex)
  722. '            articleIndex = articleIndex + 1
  723. '            state = StateGetHeader
  724. '            News1.GetHeader
  725. '        Else
  726. '            EnableControls True
  727. '            state = StateNone
  728. '        End If
  729. '    End If
  730. End Sub
  731. Sub SetPopupPos(foo As Form)
  732.     foo.Top = Me.Top + Me.Height / 5
  733.     foo.Left = Me.Left + (Me.Width - foo.Width) / 2
  734. End Sub
  735.